package com.wu.databasedemo.db.util;

import com.wu.databasedemo.db.Constant;

import android.util.Log;

public class LogUtil {

	private static boolean isDisable = false;

	private static String buildMessage(String message) {
		StackTraceElement ste = new Throwable().fillInStackTrace().getStackTrace()[2];

		StringBuffer sb = new StringBuffer();
		sb.append(ste.getClassName());
		sb.append(".");
		sb.append(ste.getMethodName());
		sb.append("(): ");
		sb.append(message);
		return sb.toString();
	}
	
	public static void d(String msg) {
		if (!isDisable) {
			Log.d(Constant.TAG, buildMessage(msg));
		}
	}

	public static void i(String msg) {
		if (!isDisable) {
			Log.i(Constant.TAG, buildMessage(msg));
		}
	}

	public static void w(String msg) {
		if (!isDisable) {
			Log.w(Constant.TAG, buildMessage(msg));
		}
	}

	public static void e(String msg) {
		if (!isDisable) {
			Log.e(Constant.TAG, buildMessage(msg));
		}
	}

}
